package com.jida.tijian.controller;

import com.jida.tijian.domain.Doctor;
import com.jida.tijian.dto.ResponseObject;
import com.jida.tijian.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 处理登录
 */
@RestController
public class DoctorController {
    //需要和ServiceImp连接 记得加@Autowired
    @Autowired
    DoctorService doctorService;

    //处理登录的业务方法
    @RequestMapping("/login")
    public ResponseObject login(@RequestBody Doctor doctor){
//        确认是否成功连接前端
        System.out.println("doctorController:" + doctor.getDocCode() + ", "+ doctor.getPassword());
        doctorService.login(doctor); //业务层的实现方法
        return  new ResponseObject<>(
                ResponseObject.SUCCESS_STATUS,
                ResponseObject.SUCCESS_DESC,
                doctorService.login(doctor)
        );//返回 约定好的类
    }

}
